<template>
    <div class="wrap-table fllow-manage conItem">
        <el-form ref="form" :model="searchData" label-width="100px" class="clearfix flex-div">
            <el-form-item label="就诊日期" class="" label-width="70px" style="width:350px">
                <div class="block">
                    <el-date-picker
                            v-model="timeDate"
                            type="daterange"
                            align="right"
                            unlink-panels
                            range-separator="至"
                            value-format="yyyy-MM-dd"
                            start-placeholder="开始日期"
                            end-placeholder="结束日期"
                            :picker-options="pickerOptions">
                    </el-date-picker>
                </div>
            </el-form-item>
            <el-form-item label="预约状态" class="" style="width: 200px">
                <el-select v-model="searchData.appointState" clearable placeholder="请选择">
                    <el-option
                            v-for="item in options1"
                            :key="item.value"
                            :label="item.label"
                            :value="item.value">
                    </el-option>
                </el-select>
            </el-form-item>
            <el-form-item label="事项状态" class=""  style="width: 200px">
                <el-select v-model="searchData.completeState" clearable placeholder="请选择">
                    <el-option
                            v-for="item in options2"
                            :key="item.value"
                            :label="item.label"
                            :value="item.value">
                    </el-option>
                </el-select>
            </el-form-item>
            <el-form-item label="儿科医生" label-width="100px" class=" item-right" style="width:200px">
                <el-select v-model="searchData.pediatricianId" clearable placeholder="请选择">
                    <el-option
                            v-for="item in optionsNurse"
                            :key="item.SYS_ID"
                            :label="item.icons"
                            :value="item.SYS_ID">
                    </el-option>
                </el-select>
            </el-form-item>
            <el-form-item label="营养师" label-width="100px" class=" item-right" style="width:200px">
                <el-select v-model="searchData.dietitianId" clearable placeholder="请选择">
                    <el-option
                            v-for="item in optionsDoc"
                            :key="item.SYS_ID"
                            :label="item.icons"
                            :value="item.SYS_ID">
                    </el-option>
                </el-select>
            </el-form-item>
            <el-form-item label="所在地区" class=" item-right" style="width:220px">
                <el-select v-model="searchData.districtNo" placeholder="请选择"  clearable :disabled="JSON.parse(UserDic).IsCommunityOnly=='1'">
                    <el-option
                            v-for="item in optionDiq"
                            :key="item.DistrictName"
                            :label="item.DistrictName"
                            :value="item.DistrictNo">
                    </el-option>
                </el-select>
            </el-form-item>
                    <el-form-item label="试验类型" class=" item-right" style="width:260px">
                        <el-select v-model="searchData.testType" clearable placeholder="请选择">
                            <el-option
                                    v-for="item in options6"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value">
                            </el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item class=" item-right" style="width:300px;margin-left: -60px" label="">
                        <el-input v-model="searchData.keyWord" placeholder="研究对象手机号/研究编号"></el-input>
                    </el-form-item>
            <div class="flex-r-but">
                <el-button type="primary" @click="checkList" class="pull-right mg-lr-20 pd-bt">查询</el-button>
            </div>

        </el-form>
        <!---->
        <template>
            <el-table
                    :data="tableData"
                    border
                    v-loading="loading"
                    element-loading-text="加载中"
                    style="width: 100%">
                <el-table-column align="center" label="序号" width="70">
                    <template  slot-scope="scope">
                        {{scope.$index+1}}
                    </template>
                </el-table-column>
                <el-table-column
                        prop="VisitDate"
                        align="center"
                        label="就诊日期"
                        min-width="160">
                    <template  slot-scope="scope">
                        <el-date-picker
                                v-model="scope.row.VisitDate"
                                :clearable="false"
                                :disabled="true"
                                @change="changeFollowUpDate(scope.row,scope.row.VisitDate)"
                                type="date"
                                value-format="yyyy-MM-dd"
                                placeholder="选择日期">
                        </el-date-picker>
                    </template>
                </el-table-column>
                <el-table-column
                        prop="VisitTime"
                        label="就诊时间"
                        align="center"
                        min-width="120">
                    <template  slot-scope="scope">
                        <el-time-select
                                v-model="scope.row.VisitTime"
                                :clearable="false"
                                @change="changeFollowUpDateOne(scope.row,scope.row.VisitTime)"
                                :picker-options="{start: '08:00', step: '00:15',end: '21:30'}"
                                placeholder="">
                        </el-time-select>
                    </template>
                </el-table-column>
                <el-table-column
                        prop="AppointState"
                        label="预约状态"
                        align="center"
                        :formatter="AppointFilter"
                        min-width="120">
                    <template  slot-scope="scope">
                        <el-select v-model="scope.row.AppointState" placeholder="请选择" @change="changeFollowUpDate(scope.row,scope.row.AppointState)">
                            <el-option
                                    v-for="item in options1s"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value">
                            </el-option>
                        </el-select>
                    </template>
                </el-table-column>
                <el-table-column
                        prop="CompleteState"
                        label="事项状态"
                        :formatter="FollowUpFilter"
                        align="center"
                        min-width="120">
                    <template  slot-scope="scope">
                        <el-select v-model="scope.row.CompleteState" placeholder="请选择" @change="changeFollowUpDate(scope.row,scope.row.CompleteState)">
                            <el-option
                                    v-for="item in options3s"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value">
                            </el-option>
                        </el-select>
                    </template>
                </el-table-column>
                <el-table-column
                        prop="Nurse"
                        label="儿科医生"
                        align="center"
                        min-width="120">
                    <template slot-scope="scope">
                        <el-select v-model="scope.row.PediatricianName" placeholder="请选择" @change="changeNurse(scope.row,scope.row.PediatricianName)">
                            <el-option
                                v-for="item in optionsNurse"
                                :key="item.SYS_ID"
                                :label="item.icons"
                                :value="item.icons">
                            </el-option>
                        </el-select>
                    </template>
                </el-table-column>
                <el-table-column
                        prop="Nurse"
                        label="营养师"
                        align="center"
                        min-width="120">
                    <template slot-scope="scope">
                        <el-select v-model="scope.row.DietitianName" placeholder="请选择" @change="changeNurse(scope.row,scope.row.DietitianName)">
                            <el-option
                                    v-for="item in optionsDoc"
                                    :key="item.SYS_ID"
                                    :label="item.icons"
                                    :value="item.icons">
                            </el-option>
                        </el-select>
                    </template>
                </el-table-column>
                <el-table-column
                        prop="Surname"
                        label="姓名首字母"
                        align="center"
                        min-width="100">
                </el-table-column>
                 <el-table-column
                    prop="ResearchNo"
                    label="研究编号"
                    align="center"
                    min-width="120"
                    ></el-table-column>
                <el-table-column
                        label="手机号"
                        align="center"
                        min-width="100">
                    <template slot-scope="scope">
                        <el-tooltip :content="scope.row.Mobile" placement="top">
                            <span class="click_line" @click="JumpUserinfo(scope.row)">{{scope.row.Mobile |mobileFilter}}</span>
                        </el-tooltip>
                    </template>
                </el-table-column>
                <el-table-column
                        prop="Period"
                        label="门诊时研究阶段"
                        :formatter="PeriodFilter"
                        align="center"
                        min-width="120">
                </el-table-column>
                <el-table-column
                        prop="Remark"
                        label="事项备注"
                        align="center"
                        min-width="160">
                    <template slot-scope="scope">
                        <el-input @blur="changeFollowUpDate(scope.row,scope.row.Remark)" v-model="scope.row.Remark" placeholder="事项备注"></el-input>
                    </template>
                </el-table-column>
                <el-table-column
                        prop="CancleReason"
                        label="事项取消原因"
                        align="center"
                        min-width="160">
                    <template slot-scope="scope">
                        <el-input @blur="changeFollowUpDate(scope.row,scope.row.CancleReason)" v-model="scope.row.CancleReason" placeholder="事项取消原因"></el-input>
                    </template>
                </el-table-column>
                <el-table-column
                        fixed="right"
                        min-width="140"
                        align="center"
                        label="儿科医生咨询表">
                    <template  slot-scope="scope">
                        <el-button size="small" style="color: #f00" v-if="scope.row.FatOutpatientPediatricianId==''" type="text"
                                   @click="handleTable(scope.row)">填写</el-button>
                        <span  class="click_line"  v-else @click="handleTable(scope.row)"><span
                                >查看</span></span>
                    </template>
                </el-table-column>
                <el-table-column
                        fixed="right"
                        min-width="140"
                        align="center"
                        label="营养师咨询表">
                    <template  slot-scope="scope">
                        <el-button v-if="scope.row.FatOutpatientDietitianId!==''" size="small" type="text"  @click="handleReport(scope.row)">查看</el-button>
                        <el-button style="color: #f00" v-else size="small" type="text"  @click="handleReport(scope.row)">填写</el-button>
                    </template>
                </el-table-column>
            </el-table>
        </template>
        <!--分页-->
        <div class="block mg-20-auto pagination-fixed">
            <el-pagination
                    @size-change="handleSizeChange"
                    @current-change="handleCurrentChange"
                    :current-page.sync="pageId"
                    :page-sizes="[10, 20, 30, 40]"
                    :page-size="pageSize"
                    layout="total, sizes, prev, pager, next, jumper"
                    :total="total">
            </el-pagination>
        </div>
        <!--营养师咨询表  oneStep-->
        <el-dialog title="营养师咨询表" :visible.sync="dialogFormAnli" :append-to-body="true" top="0" width="60%"
                   :close-on-click-modal="false">
                <div style="margin-right: 20px;overflow-x: hidden">
                    <p style="margin-bottom: 15px;font-weight: bold">研究对象：{{formPoint.Surname}}({{formPoint.ResearchNo}}) <span
                            style="padding-left: 15px;">研究阶段：{{formPoint.Period |PeriodFilters}}</span>
                        <span style="padding-left: 15px;">手机号：{{formPoint.Mobile |mobileFilter}}</span>
                    </p>
                    <div style="margin: 10px 0px;">
                        <label>咨询类型</label>
                        <el-select style="display:inline-block;width: 200px;margin-left: 10px"
                                   size="small"
                                   @change="changeOther('FormAnli','ConsultationType','ConsultationTypeOther','3')"
                                   v-model="FormAnli.ConsultationType">
                            <el-option value="1" label="评估"></el-option>
                            <el-option value="2" label="随访"></el-option>
                            <el-option value="3" label="其他"></el-option>
                        </el-select>
                        <el-input
		                        size="small"
                                style="display: inline-block;width: 300px;margin-left: 10px"
                                v-if="FormAnli.ConsultationType == 3"
                                v-model="FormAnli.ConsultationTypeOther"
                                placeholdyer="请输入具体内容">
                        </el-input>
                    </div>
                    <div class="formX">
                        <ul>
                            <li style="border-bottom: none">
                                <h4 class="forl-div"><span>1.以往和社区医生针对孩子情况进行过交流</span>
                                    <el-radio-group v-model="FormAnli.Discuss"
                                        style="display: inline-block;margin-left: 33px">
                                        <el-radio label="1">是</el-radio>
                                        <el-radio label="2">否</el-radio>
                                    </el-radio-group>
                                </h4>
                                <h5 v-if="FormAnli.Discuss == '1'">1.1 最近一次交流的日期
                                    <el-date-picker
                                            style="display: inline-block;margin-left:35px;width: 300px;"
                                            v-model="FormAnli.DiscussDate"
                                            value-format="yyyy-MM-dd"
                                            type="date"
                                            placeholder="选择日期">
                                    </el-date-picker>
                                </h5>
                                <h4>2.转介的原因</h4>
                                <el-input
                                        type="textarea"
                                        :rows="5"
                                        style="padding-left: 50px"
                                        :disabled="Plis"
                                        placeholder="限200字"
                                        v-model="FormAnli.TransReason">
                                </el-input>
                                <h4>3.孩子营养摄入</h4>
                                <h5 class="forl-div"><span>充足的能量摄入</span>
                                    <el-radio-group v-model="FormAnli.NutritionEnergy"
                                                    style="display: inline-block;">
                                        <el-radio label="1">是</el-radio>
                                        <el-radio label="2">否</el-radio>
                                    </el-radio-group>
                                </h5>
                                <h5 class="forl-div"><span>充足多样的食物(如谷物；牛奶；水果蔬菜；肉等)</span>
                                    <el-radio-group v-model="FormAnli.NutritionAmpleFood"
                                                    style="display: inline-block;">
                                        <el-radio label="1">是</el-radio>
                                        <el-radio label="2">部分</el-radio>
                                        <el-radio label="3">否</el-radio>
                                    </el-radio-group>
                                </h5>
	                            <h5 class="forl-div"><span>果汁饮料的摄入</span>
                                    <el-radio-group v-model="FormAnli.NutritionDrinks"
                                                    style="display: inline-block;">
                                        <el-radio label="1">经常</el-radio>
                                        <el-radio label="2">偶尔</el-radio>
                                        <el-radio label="3">很少</el-radio>
                                    </el-radio-group>
                                </h5>
	                            <h5 class="forl-div"><span>有营养的小吃</span>
                                    <el-radio-group v-model="FormAnli.NutritionSnack"
                                                    style="display: inline-block;">
                                        <el-radio label="1">是</el-radio>
                                        <el-radio label="2">否</el-radio>
                                    </el-radio-group>
                                </h5>
	                            <h5 class="forl-div"><span>微量营养素均衡(如:钠；钙；铁等)</span>
                                    <el-radio-group v-model="FormAnli.NutritionTraceElement"
                                                    style="display: inline-block;">
                                        <el-radio label="1">是</el-radio>
                                        <el-radio label="2">部分</el-radio>
                                        <el-radio label="3">否</el-radio>
                                    </el-radio-group>
                                </h5>
                                <h5>
                                    备注:
                                </h5>
                                <el-input
                                        type="textarea"
                                        :rows="5"
                                        style="padding-left: 50px"
                                        :disabled="Plis"
                                        placeholder="限500字"
                                        v-model="FormAnli.NutrtionOther">
                                </el-input>
                                <h4>4.提供给孩子的食物</h4>
                                <h5 class="forl-div"><span>
	                                充足多样的食物</span>
                                    <el-radio-group v-model="FormAnli.FoodEnough"
                                                    style="display: inline-block;">
                                        <el-radio label="1">是</el-radio>
                                        <el-radio label="2">部分</el-radio>
                                        <el-radio label="3">否</el-radio>
                                    </el-radio-group>
                                </h5>
                                <h5 class="forl-div"><span>
	                                外卖或者快餐</span>
                                    <el-radio-group v-model="FormAnli.FoodFast"
                                                    style="display: inline-block;">
                                        <el-radio label="1">经常</el-radio>
                                        <el-radio label="2">有时</el-radio>
                                        <el-radio label="3">从不</el-radio>
                                    </el-radio-group>
                                </h5>
                                <h5>
                                    备注:
                                </h5>
                                <el-input
                                        type="textarea"
                                        :rows="5"
                                        style="padding-left: 50px"
                                        :disabled="Plis"
                                        placeholder="限500字"
                                        v-model="FormAnli.FoodRemark">
                                </el-input>
                                <h4>5.孩子饮食和生活方式习惯</h4>
                                <h5 class="forl-div"><span>
	                                根据孩子发出的饥饿和饱足信号喂食</span>
                                    <el-radio-group v-model="FormAnli.Habit1"
                                                    style="display: inline-block;">
                                        <el-radio label="1">是</el-radio>
                                        <el-radio label="2">否</el-radio>
                                    </el-radio-group>
                                </h5>
                                <h5 class="forl-div"><span>
	                                孩子在就餐时的胃口</span>
                                    <el-radio-group v-model="FormAnli.Habit2"
                                                    style="display: inline-block;">
                                        <el-radio label="1">好</el-radio>
                                        <el-radio label="2">中等</el-radio>
                                        <el-radio label="3">差</el-radio>
                                    </el-radio-group>
                                </h5>
                                <h5 class="forl-div"><span>
	                                规律的家庭就餐</span>
                                    <el-radio-group v-model="FormAnli.Habit3"
                                                    style="display: inline-block;">
                                        <el-radio label="1">是</el-radio>
                                        <el-radio label="2">否</el-radio>
                                    </el-radio-group>
                                </h5>
                                <h5 class="forl-div"><span>
	                                在就餐时分心(如看电视，玩玩具等)</span>
                                    <el-radio-group v-model="FormAnli.Habit4"
                                                    style="display: inline-block;">
                                        <el-radio label="1">经常</el-radio>
                                        <el-radio label="2">有时</el-radio>
                                        <el-radio label="3">从不</el-radio>
                                    </el-radio-group>
                                </h5>
                                <h5 class="forl-div"><span>
	                                使用有奶嘴的瓶子</span>
                                    <el-radio-group v-model="FormAnli.Habit5"
                                                    style="display: inline-block;">
                                        <el-radio label="1">经常</el-radio>
                                        <el-radio label="2">有时</el-radio>
                                        <el-radio label="3">从不</el-radio>
                                    </el-radio-group>
                                </h5>
                                <h5 class="forl-div"><span>
	                                孩子自己在就餐时进食</span>
                                    <el-radio-group v-model="FormAnli.Habit6"
                                                    style="display: inline-block;">
                                        <el-radio label="1">经常</el-radio>
                                        <el-radio label="2">有时</el-radio>
                                        <el-radio label="3">从不</el-radio>
                                    </el-radio-group>
                                </h5>
                                <h5 class="forl-div"><span>
	                                喂食有关的问题(如咀嚼，吞咽问题等)</span>
                                    <el-radio-group v-model="FormAnli.Habit7"
                                                    @change="changeOther('FormAnli','Habit7','HabitFeeding','1')"
                                                    style="display: inline-block;">
                                        <el-radio label="1">是</el-radio>

                                        <el-radio label="2">否</el-radio>
                                    </el-radio-group>

                                </h5>
	                            <div style="text-align: right">
		                            <el-input placeholder="哪位家庭成员"
		                                      v-if="FormAnli.Habit7 == '1'"
		                                      style="display: inline-block;width: 200px;margin-right: 80px;"
		                                      size="small"
		                                      v-model="FormAnli.HabitFeeding"></el-input>
	                            </div>

                                <h5 class="forl-div"><span>
	                                每天平均接触屏幕的时间</span>
                                    <el-radio-group v-model="FormAnli.Habit8"
                                                    style="display: inline-block;">
                                        <el-radio label="1">无</el-radio>
                                        <el-radio label="2">1-3小时</el-radio>
                                        <el-radio label="3">超过3小时</el-radio>
                                    </el-radio-group>
                                </h5>
                                <h5 class="forl-div"><span>
	                                孩子的身体活动(根据家长的认知)</span>
                                    <el-radio-group v-model="FormAnli.Habit9"
                                                    style="display: inline-block;">
                                        <el-radio label="1">很少</el-radio>
                                        <el-radio label="2">中等</el-radio>
                                        <el-radio label="3">很多</el-radio>
                                    </el-radio-group>
                                </h5>
                                <h5>
                                    备注:
                                </h5>
                                <el-input
                                        type="textarea"
                                        :rows="5"
                                        style="padding-left: 50px"
                                        :disabled="Plis"
                                        placeholder="限500字"
                                        v-model="FormAnli.HabitRemark">
                                </el-input>
                                <h4>
                                    6.食品安全
                                </h4>
                                <h5 class="forl-div"><span>
	                                购买食物的经济手段有限</span>
                                    <el-radio-group v-model="FormAnli.FoodSafeEconomics"
                                                    style="display: inline-block;">
                                        <el-radio label="1">很少</el-radio>
                                        <el-radio label="2">中等</el-radio>
                                        <el-radio label="3">很多</el-radio>
                                    </el-radio-group>
                                </h5>
                                <h5 class="forl-div"><span>
	                                家庭居住环境获得营养食物的能力</span>
                                    <el-radio-group v-model="FormAnli.FoodSafeNutrtion"
                                                    style="display: inline-block;">
                                        <el-radio label="1">很少</el-radio>
                                        <el-radio label="2">中等</el-radio>
                                        <el-radio label="3">很多</el-radio>
                                    </el-radio-group>
                                </h5>
                                <h5>
                                    备注:
                                </h5>
                                <el-input
                                        type="textarea"
                                        :rows="5"
                                        style="padding-left: 50px"
                                        :disabled="Plis"
                                        placeholder="限500字"
                                        v-model="FormAnli.FoodSafeRemark">
                                </el-input>
                                <h4>
                                    7.主要的饮食问题
                                </h4>
                                <el-input
                                        type="textarea"
                                        :rows="5"
                                        style="padding-left: 50px"
                                        :disabled="Plis"
                                        placeholder="限500字"
                                        v-model="FormAnli.DietQuestion">
                                </el-input>
                                <h4>
                                    8.主要的营养建议
                                </h4>
                                <el-input
                                        type="textarea"
                                        :rows="5"
                                        style="padding-left: 50px"
                                        :disabled="Plis"
                                        placeholder="限500字"
                                        v-model="FormAnli.NutritionAdvice">
                                </el-input>
                                <h4 class="forl-div"><span>
	                                9.资源提供</span>
                                    <el-radio-group v-model="FormAnli.ResourceProvision"
                                                    style="display: inline-block;margin-left: 32px;">
                                        <el-radio label="1">是</el-radio>
                                        <el-radio label="2">否</el-radio>
                                    </el-radio-group>
                                </h4>
                                <h5>
                                    具体:
                                </h5>
                                <el-input
                                        type="textarea"
                                        :rows="5"
                                        style="padding-left: 50px"
                                        :disabled="Plis"
                                        placeholder="限500字"
                                        v-model="FormAnli.ResourceProvisionDetail">
                                </el-input>
                                <h4 class="forl-div"><span>
	                                10.需要和社区HCP更深入交流这个案例</span>
                                    <el-radio-group v-model="FormAnli.DeepDiscuss"
                                                    style="display: inline-block;margin-left: 32px;">
                                        <el-radio label="1">是</el-radio>
                                        <el-radio label="2">否</el-radio>
                                    </el-radio-group>
                                </h4>
                                <h4 class="forl-div"><span>
	                                11.与营养师预约下个肥胖门诊（如果需要）</span>
                                    <el-radio-group v-model="FormAnli.AppointFatClinic"
                                                    style="display: inline-block;margin-left: 32px;">
                                        <el-radio label="1">是</el-radio>
                                        <el-radio label="2">否</el-radio>
                                    </el-radio-group>
                                </h4>
                                <h4>12.给社区HCP的意见</h4>
                                <el-input
                                        type="textarea"
                                        :rows="5"
                                        style="padding-left: 50px"
                                        :disabled="Plis"
                                        placeholder="限500字"
                                        v-model="FormAnli.ToHCPAdvice">
                                </el-input>
                            </li>
                        </ul>
                    </div>
                </div>
            <div slot="footer" class="dialog-footer">
                <el-button type="danger" v-if="RoleGroup==1 &&hasCount" @click="deleteCrf" style="float: left;">删 除</el-button>
                <el-button @click="dialogFormAnli = false">关 闭</el-button>
                <el-button type="primary" v-if="RoleGroup == 5" @click="reportSure('FormAnli')">保 存</el-button>
            </div>
        </el-dialog>
        <!--儿科医生咨询表-->
        <el-dialog title="儿科医生咨询表" v-if="dialogForm1" :visible.sync="dialogForm1" :append-to-body="true" top="0" width="80%"
                   :close-on-click-modal="false">
                <div style="margin-right: 20px">
                    <p style="margin-bottom: 15px;font-weight: bold">研究对象：{{formPoint.Surname}}({{formPoint.ResearchNo}}) <span
                            style="padding-left: 15px;">研究阶段：{{formPoint.Period |PeriodFilters}}</span>
                        <span style="padding-left: 15px;">手机号：{{formPoint.Mobile |mobileFilter}}</span>
                    </p>
                    <div style="margin: 10px 0px;">
                        <label>咨询类型</label>
                        <el-select size="small" style="display:inline-block;width: 200px;margin-left: 10px"
                                   @change="changeOther('formx','ConsultationType','ConsultationTypeOther','3')"
                                   v-model="formx.ConsultationType">
                            <el-option value="1" label="评估"></el-option>
                            <el-option value="2" label="随访"></el-option>
                            <el-option value="3" label="其他"></el-option>
                        </el-select>
                        <el-input
                                style="display: inline-block;width: 300px;margin-left: 10px"
                                v-if="formx.ConsultationType == '3'"
                                v-model="formx.ConsultationTypeOther"
                                placeholdyer="请输入具体内容">
                        </el-input>
                    </div>
                    <div class="formX">
                        <ul>
                            <li>
                                <h3>1.既往儿童保健史</h3>
                                <h4><span>1.1 以往和社区医生针对孩子情况进行过讨论</span>
                                    <el-radio-group v-model="formx.Discuss"
                                                    style="display: inline-block;">
                                        <el-radio label="1">是</el-radio>
                                        <el-radio label="2">否</el-radio>
                                    </el-radio-group>
                                </h4>
                                <h5 v-if="formx.Discuss == '1'">1.1.1 最近一次讨论的日期
                                    <el-date-picker
                                            size="small"
                                            style="display: inline-block;margin-left:35px;width: 300px;"
                                            v-model="formx.DiscussDate"
                                            value-format="yyyy-MM-dd"
                                            type="date"
                                            placeholder="选择日期">
                                    </el-date-picker>
                                </h5>
                                <h4><span>1.2 接受过生命树肥胖门诊以外机构的对肥胖儿童进行的专业保健(如区或更高级别的医院，私人诊所)</span>
                                    <el-radio-group v-model="formx.HealthCare"
                                                    style="display: inline-block;">
                                        <el-radio label="1">是</el-radio>
                                        <el-radio label="2">否</el-radio>
                                    </el-radio-group>
                                </h4>
                                <h4><span>1.3 父母已经接触过生命树项目的营养师</span>
                                    <el-radio-group v-model="formx.ContactNutritionist"
                                                    style="display: inline-block;">
                                        <el-radio label="1">是</el-radio>
                                        <el-radio label="2">否</el-radio>
                                    </el-radio-group>
                                </h4>
                                <h5 v-if="formx.ContactNutritionist == '1'">1.3.1 最近一次/下次预约的日期
                                    <el-date-picker
                                            size="small"
                                            style="display: inline-block;margin-left:35px;width: 300px;"
                                            v-model="formx.AppointDate"
                                            value-format="yyyy-MM-dd"
                                            type="date"
                                            placeholder="选择日期">
                                    </el-date-picker>
                                </h5>
                            </li>
                            <li>
                                <h3>2.家长信息</h3>
                                <h4>2.1 家长对儿童肥胖的认知/态度?</h4>
                                <h5>
                                    <el-checkbox v-model="formx.FatCognition1" true-label="1" style="display:
                                                 inline-block;">否认儿童肥胖</el-checkbox>
                                    <el-input size="small" placeholder="哪位家庭成员"
                                              v-if="formx.FatCognition1 == '1'"
                                              style="display: inline-block;width: 200px;margin-left: 70px"
                                              v-model="formx.FatCognitionFamliy1"></el-input>
                                </h5>
                                <h5>
                                    <el-checkbox v-model="formx.FatCognition2" true-label="1"  style="display: inline-block;">
                                        不关心儿童是否肥胖</el-checkbox>
                                    <el-input size="small" placeholder="哪位家庭成员"
                                              v-if="formx.FatCognition2 == '1'"
                                              style="display: inline-block;width: 200px;margin-left: 29px"
                                              v-model="formx.FatCognitionFamliy2"></el-input>
                                </h5>
                                <h5>
                                    <el-checkbox v-model="formx.FatCognition3" true-label="1" style="display: inline-block;">担心儿童肥胖</el-checkbox>
                                    <el-input size="small" placeholder="哪位家庭成员"
                                              v-if="formx.FatCognition3 == '1'"
                                              style="display: inline-block;width: 200px;margin-left: 70px"
                                              v-model="formx.FatCognitionFamliy3"></el-input>
                                </h5>
                                <h5>
                                    <el-checkbox v-model="formx.FatCognition4" true-label="1"  style="display: inline-block;">
                                        对儿童肥胖有错误的观念</el-checkbox>
                                    <el-input size="small" placeholder="哪位家庭成员"
                                              v-if="formx.FatCognition4 == '1'"
                                              style="display: inline-block;width: 200px;"
                                              v-model="formx.FatCognitionFamliy4"></el-input>
                                </h5>
                                <h5>
                                    <el-checkbox v-model="formx.FatCognition5" true-label="1" style="display: inline-block;">
                                        认识到孩子的肥胖</el-checkbox>
                                    <el-input size="small" placeholder="哪位家庭成员"
                                              v-if="formx.FatCognition5 == '1'"
                                              style="display: inline-block;width: 200px;margin-left: 42px"
                                              v-model="formx.FatCognitionFamliy5"></el-input>
                                </h5>
                            </li>
                            <li>
                                <h3>3.孩子目前健康和医疗信息概况</h3>
                                <h4><span>3.1 在访谈时进行了人体学测量并在生命树网页端（儿童生长发育记录版块）记录了数据</span>
                                    <el-radio-group v-model="formx.RecordData"
                                                    style="display: inline-block;">
                                        <el-radio label="1">是</el-radio>
                                        <el-radio label="2">否</el-radio>
                                    </el-radio-group>
                                </h4>
                                <h4>3.2 饮食信息
                                </h4>
                                <h5 class="check-1">3.2.1 针对家长的问题
                                    <p>A 您的孩子更喜欢</p>
                                    <el-checkbox-group v-model="ChildLikeFoods" style="margin: 0 30px" >
                                        <el-checkbox label="1">富含瘦肉的动物食品</el-checkbox>
                                        <el-checkbox label="2">富含脂肪的动物食品</el-checkbox>
                                        <el-checkbox label="3">蔬菜</el-checkbox>
                                        <el-checkbox label="4" >豆制品</el-checkbox>
                                        <el-checkbox label="5">以上选项都不符合</el-checkbox>
                                    </el-checkbox-group>
                                    <p>B 您的孩子有以下饮食习惯吗？</p>
                                    <el-checkbox-group v-model="DietHabit" style="margin: 0 30px" >
                                        <el-checkbox label="1">喜欢吃零食</el-checkbox>
                                        <el-checkbox label="2">一点点轻咬着吃</el-checkbox>
                                        <el-checkbox label="3">吃东西的时候喜欢玩电子游戏，看电视，玩电脑</el-checkbox>
                                        <el-checkbox label="4" >以上选项都不符合</el-checkbox>
                                    </el-checkbox-group>
                                    <p >
                                        C 您的孩子喜欢甜的饮料吗？

                                    </p>
                                    <el-radio-group v-model="formx.LikeSweetDrinks" style="margin: 5px 0 5px 30px" >
                                        <el-radio label="1">是</el-radio>
                                        <el-radio label="2">否</el-radio>
                                    </el-radio-group>
                                    <p>D 您的孩子喜欢以下食物吗</p>
                                    <el-checkbox-group v-model="LikeFoodType" style="margin: 0 30px" >
                                        <el-checkbox label="1">高脂高盐零食</el-checkbox>
                                        <el-checkbox label="2">甜食</el-checkbox>
                                        <el-checkbox label="3">快餐</el-checkbox>
                                        <el-checkbox label="4">以上选项都不符合</el-checkbox>
                                    </el-checkbox-group>
                                </h5>
                                <h5 >3.2.2 与饮食习惯或营养有关的主要问题/结论或营养师提出的主要饮食注意事项</h5>
                                <el-input
                                        type="textarea"
                                        :rows="5"
                                        style="padding-left: 80px"
                                        :disabled="Plis"
                                        placeholder="限500字"
                                        v-model="formx.Conclusion">
                                </el-input>
                                <h4 >3.3 体育锻炼信息</h4>
                                <h5>3.3.1 针对家长的问题（家长需直接在电脑上回答下列问题）</h5>
                                <div class="parentDiv" >
                                    <p>说明：请圈出最符合您孩子近六个月情况的数字。例如近六个月您孩子倾向于独自玩耍的时间约等于倾向于和其他孩子一起玩耍的时间，
                                       则第一个问题圈数字3；如果您孩子大多数时间倾向于和其他孩子一起玩耍的时间，则圈数字5</p>
                                    <table ref="tableDom">
                                        <tr>
                                            <td style="min-width: 250px;"></td>
                                            <td>总是</td>
                                            <td></td>
                                            <td>差不多</td>
                                            <td></td>
                                            <td>总是</td>
                                            <td style="min-width: 230px;"></td>
                                        </tr>
                                        <tr>
                                            <td class="pdl">(1) 倾向于独自玩耍</td><td v-for="item
                                            in 5" :key="item"
                                                                                               width="100"
                                                                     style="cursor:pointer"
                                                @click="getBub($event,item)">
                                                {{item}}</td><td class="pdl">倾向于和其他孩子一起玩耍</td>
                                        </tr>
                                        <tr>
                                            <td class="pdl">(2) 倾向于运动量大的游戏（如踢球）</td><td v-for="item in 5" width="100"
                                                                 :key="item"            style="cursor: pointer"
                                                                    @click="getBub($event,item)">
                                            {{item}}</td><td class="pdl">倾向于安静的游戏（如桌游）</td>
                                        </tr>
                                        <tr>
                                            <td class="pdl">(3) 不喜欢运动（如足球，篮球）</td><td v-for="item in 5" width="100"
                                                               :key="item"            style="cursor: pointer"
                                                                            @click="getBub($event,item)">
                                            {{item}}</td><td class="pdl">喜欢运动</td>
                                        </tr>
                                        <tr>
                                            <td class="pdl">(4) 内向（如安静的、不活跃的）</td><td v-for="item in 5" width="100"
                                                                      :key="item"     style="cursor: pointer"
                                                                          @click="getBub($event,item)">
                                            {{item}}</td><td class="pdl">外向</td>
                                        </tr>
                                        <tr>
                                            <td class="pdl">(5) 喜欢阅读</td><td v-for="item in 5" width="100" style="cursor: pointer"
                                                                     :key="item"     @click="getBub($event,item)">
                                            {{item}}</td><td class="pdl">不喜欢阅读</td>
                                        </tr>
                                        <tr>
                                            <td class="pdl">(6) 喜欢在户外玩耍</td><td v-for="item in 5" :key="item" width="100" style="cursor:
                                            pointer"
                                                                 @click="getBub($event,item)">
                                            {{item}}</td><td class="pdl">喜欢在室内玩耍（如家里，学校）</td>
                                        </tr>
                                        <tr>
                                            <td class="pdl">(7) 与同龄孩子相比体育活动更少</td><td v-for="item in 5" :key="item" width="100"
                                                                           style="cursor: pointer"
                                                                    @click="getBub($event,item)">
                                            {{item}}</td><td class="pdl">与同龄孩子相比体育锻炼更多</td>
                                        </tr>
                                    </table>
                                    <p>说明：请根据您孩子近六个月的日常回答下列问题</p>
                                    <h4>(8) 您孩子平均每天看电视（包括视频电影）的时长是
                                    <el-input size="small" type="number"
                                              style="display:inline-block;width: 100px;margin:0 20px;"
                                              v-model="formx.WatchVideoTime"></el-input>小时/天（请精确到1/4小时，即15分钟）
                                    </h4>
                                </div>
	                            <h5 >3.3.2 与体育活动或久坐行为有关的主要问题/结论</h5>
	                            <el-input
			                            type="textarea"
			                            :rows="5"
			                            style="padding-left: 80px;margin-bottom: 10px;"
			                            :disabled="Plis"
			                            placeholder="限500字"
			                            v-model="formx.SportActionQuestion">
	                            </el-input>
	                            <h4>3.4 生活习惯信息</h4>
	                            <h5>3.4.1 针对家长的问题
	                                <p style="display: flex;line-height: 36px">
                                        <span style="flex: 5">(1) 您孩子晚上睡觉的时间</span>
		                                <el-time-select
                                                size="small"
				                                style="flex: 2"
				                                v-model="formx.SleepTime"
                                                default-value="20:00"
				                                :picker-options="{start: '18:30',step: '00:15',end: '24:00'}"
				                                placeholder="选择时间">
		                                </el-time-select>
	                                </p>
		                            <p style="display: flex;line-height: 36px">
                                        <span  style="flex: 5">(2) 您孩子早晨起床的时间</span>
			                            <el-time-select
                                                size="small"
                                                style="flex: 2"
					                            v-model="formx.GetupTime"
                                                default-value="07:00"
					                            :picker-options="{start: '00:30',step: '00:15',end: '12:00'}"
					                            placeholder="选择时间">
			                            </el-time-select>
		                            </p>
		                            <p style="display: flex;line-height: 36px">
                                        <span  style="flex: 5">(3) 您孩子经常会气喘吗？</span>
			                            <el-radio-group v-model="formx.Asthma"
                                                        style="flex: 2">
				                            <el-radio label="1">是</el-radio>
				                            <el-radio label="2">否</el-radio>
			                            </el-radio-group>
		                            </p>
                                    <p style="display: flex;line-height: 36px">
                                        <span style="flex: 5">(4) 您孩子有睡眠呼吸暂停吗？</span>
                                        <el-radio-group v-model="formx.Apnea"
                                                        style="flex: 2">
                                            <el-radio label="1">是</el-radio>
                                            <el-radio label="2">否</el-radio>
                                        </el-radio-group>
                                    </p>
	                            </h5>
	                            <h4>3.5 体检信息</h4>
	                            <h5>3.5.1 与体育活动或久坐行为有关的主要问题/结论
		                            <el-input
				                            type="textarea"
				                            :rows="5"
				                            style="margin:10px 20px"
				                            :disabled="Plis"
				                            placeholder="限500字"
				                            v-model="formx.CheckActionQuestion">
		                            </el-input>
	                            </h5>
	                            <h5>3.5.2 根据孩子情况做的常规实验室检查结果（如血糖，血脂、血压等异常结果）
		                            <el-input
				                            type="textarea"
				                            :rows="5"
				                            style="margin:10px 20px"
				                            :disabled="Plis"
				                            placeholder="限500字"
				                            v-model="formx.CheckResult">
		                            </el-input>
	                            </h5>
                            </li>
                            <li>
                                <h3>4.建议和随访</h3>
	                            <h4>4.1 主要的生活方式建议</h4>
                                <h5>
	                                <el-checkbox true-label="1" v-model="formx.LifeStyleAdvice1">营养方面，具体</el-checkbox>
	                                <el-input type="text"
                                              size="small"
                                              style="display:inline-block;width: 300px;padding-left:30px"
                                              placeholder="限50字"
	                                          v-model="formx.LifeStyleAdviceDetail1"></el-input>
                                </h5>
	                            <h5>
		                            <el-checkbox true-label="1" v-model="formx.LifeStyleAdvice2">体育活动方面，具体</el-checkbox>
		                            <el-input size="small" type="text" placeholder="限50字"
                                              style="display:inline-block;width: 270px;margin-left:2px"
                                              v-model="formx.LifeStyleAdviceDetail2"></el-input>
	                            </h5>
	                            <h5>
		                            <el-checkbox true-label="1" v-model="formx.LifeStyleAdvice3">睡眠方面，具体</el-checkbox>
		                            <el-input size="small" type="text"
                                               style="display:inline-block;width: 300px;padding-left:30px" placeholder="限50字"
		                                      v-model="formx.LifeStyleAdviceDetail3"></el-input>
	                            </h5>
	                            <h5>
		                            <el-checkbox true-label="1" v-model="formx.LifeStyleAdvice4">榜样示范，具体</el-checkbox>
		                            <el-input size="small" type="text"
                                               style="display:inline-block;width: 300px;padding-left:30px" placeholder="限50字"
		                                      v-model="formx.LifeStyleAdviceDetail4"></el-input>
	                            </h5>
	                            <h5>
		                            <el-checkbox true-label="1" v-model="formx.LifeStyleAdvice5">环境方面，具体</el-checkbox>
		                            <el-input size="small" type="text"
                                               style="display:inline-block;width: 300px;padding-left:30px" placeholder="限50字"
		                                      v-model="formx.LifeStyleAdviceDetail5"></el-input>
	                            </h5>
	                            <h5>
		                            <el-checkbox true-label="1" v-model="formx.LifeStyleAdvice6">支持系统，具体</el-checkbox>
		                            <el-input size="small" type="text"
                                               style="display:inline-block;width: 300px;padding-left:30px" placeholder="限50字"
		                                      v-model="formx.LifeStyleAdviceDetail6"></el-input>
	                            </h5>
	                            <h5>
		                            <el-checkbox true-label="1" v-model="formx.LifeStyleAdvice7">其他，具体</el-checkbox>
		                            <el-input size="small" type="text"
                                               style="display:inline-block;width: 329px;padding-left:58px" placeholder="限50字"
		                                      v-model="formx.LifeStyleAdviceDetail7"></el-input>
	                            </h5>
	                            <h4>
		                            <span>4.2 提供资源</span>
		                            <el-radio-group v-model="formx.Resources"
		                                            style="flex: 4">
			                            <el-radio label="1">是</el-radio>
			                            <el-radio label="2">否</el-radio>
		                            </el-radio-group>
	                            </h4>
	                            <h4>
		                            <span>4.3 需要和社区HCP深入讨论这个案例</span>
		                            <el-radio-group v-model="formx.NeedDiscuss"
                                                    style="flex: 4">
			                            <el-radio label="1">是</el-radio>
			                            <el-radio label="2">否</el-radio>
		                            </el-radio-group>
	                            </h4>
	                            <h4>
		                            <span>4.4 预约下个肥胖门诊（如果需要）</span>
		                            <el-radio-group v-model="formx.AppointFatClinic"
                                                    style="flex: 4">
			                            <el-radio label="1">是</el-radio>
			                            <el-radio label="2">否</el-radio>
		                            </el-radio-group>
	                            </h4>
	                            <h4 class="check_1">
		                            4.5 孩子保健随访
		                            <el-checkbox-group v-model="FollowUp"  >
			                            <el-checkbox label="1">肥胖门诊</el-checkbox>
			                            <el-checkbox label="2">社区</el-checkbox>
			                            <el-checkbox label="3">肥胖门诊和社区共同随访</el-checkbox>
			                            <el-checkbox label="4" >区医院</el-checkbox>
			                            <el-checkbox label="5">私人诊所</el-checkbox>
			                            <el-checkbox label="6">其他</el-checkbox>
			                            <el-input type="text"
			                                      style="display:inline-block;width: 180px;"
			                                      v-model="formx.FollowUpOther" placeholder="限50字" size="small"></el-input>
		                            </el-checkbox-group>
	                            </h4>
                            </li>
                            <li>
                                <h3>备注</h3>

                                <el-input
                                        type="textarea"
                                        style="margin-top: 10px;"
                                        :rows="5"
                                        :disabled="Plis"
                                        placeholder="限500字"
                                        v-model="formx.Remark">
                                </el-input>

                            </li>
                        </ul>
                    </div>
                </div>
            <div slot="footer" class="dialog-footer" >
	            <el-button type="danger" v-if="RoleGroup==1 &&hasCount" @click="deleteChildTR" style="float: left">删 除</el-button>
                <el-button @click="dialogForm1 = false">关 闭</el-button>
                <el-button type="primary" v-if="RoleGroup == 11" @click="submitForm(1)">保 存</el-button>
            </div>
        </el-dialog>
    </div>
</template>
<script>
import {mapGetters} from 'vuex'
import {DIC_PERIODA,filterPeriod} from '@/utils/localDic'
export default {
    data() {
        return {
            searchData:{
                appointState:'',
                completeState: '',
                userState:'',
                groupType:'',
                keyWord:'',
                period:'',
                districtNo:'',
                testType:'2',
	            pediatricianId:'',
	            dietitianId:''
            },
	        optionsNurse:[],
	        optionsDoc:[],
            timeDate:[],
            pickerOptions: {
                shortcuts: [{
                    text: '最近一周',
                    onClick(picker) {
                    const end = new Date();
                    const start = new Date();
                    start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
                    picker.$emit('pick', [start, end]);
                    }
                }, {
                    text: '最近一个月',
                            onClick(picker) {
                        const end = new Date();
                        const start = new Date();
                        start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
                        picker.$emit('pick', [start, end]);
                    }
                }, {
                    text: '最近三个月',
                            onClick(picker) {
                        const end = new Date();
                        const start = new Date();
                        start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
                        picker.$emit('pick', [start, end]);
                    }
                }],
            },
            pageId:1,
            total:null,
            loading:true,
            pageSize:10,
            tableData:[],
            options1:  [{value: '', label: '全部'},{value: '0', label: '待确认'},{value: '1', label: '已确认'}, {value: '2', label: '已取消'}],
            options1s: [{value: '0', label: '待确认'},{value: '1', label: '已确认'}, {value: '2', label: '已取消'}],
            options2: [{value: '', label: '全部'},{value: '0', label: '待完成'}, {value: '1', label: '已完成'}, {value: '2', label: '已取消'}, {value: '3', label: '爽约'}],
            options3s: [ {value: '0', label: '待完成'}, {value: '1', label: '已完成'},{value: '2', label: '已取消'}, {value: '3', label: '爽约'}],
            optionss6: [{value: '', label: '全部'},{value: '1', label: 'A'}, {value: '2', label: 'B'}],
            options6: [{value: '', label: '全部'},{value: '0', label: '预试验'},{value: '1', label: '正式试验'},{value: '2', label: '预试验+正式试验'}],
            options2sp: DIC_PERIODA,
            PeriodFilter(row, column, cellValue, index){
                return filterPeriod(cellValue)
            },
            IntensityFilter(row, column, cellValue, index){
                return cellValue==1?'AA':'A'
            },
            AppointFilter(row, column, cellValue, index){
                return cellValue==1?'已预约':(cellValue==0?'待确认':'已取消')
            },
            FollowUpFilter(row, column, cellValue, index){
                return cellValue==1?'已完成':'待完成'
            },
            maxHeight:'',
            ResearchObjectId:'',
            ScheduleId:'',
            showActive:false,
            pageSizeQ:5,
            pageIdQ:1,
            tablerow:null,
            totalQ:null,
            copyObject:null,
            onOFFsub:false,
            optionsNurse:[],
            dialogVisible:false,
            dialogFormAnli:false,
            formPoint:{},
            FormAnli:{

            },
            Companions:[],
            rowOff:false,
            dataRow:{},
            dialogForm1:false,
            formx:{

            },
            Plis:false,
            labelList:[],
            onOFFsub:false,
            sysId:'',
            ResearchObjectId:'',
            tableDataQ:[],
            optionDiq:[],
	        hasCount:false,
	        ChildLikeFoods:[],
	        DietHabit:[],
	        LikeFoodType:[],
	        FollowUp:[],
	       // RoleGroup:'11'
        }
    },
    filters:{
        IsFillInQuestionFilter(cellValue){
            if(cellValue==1){
                return '已完成'
            }
            else if(cellValue==0){
                return '未完成'
            }
            else{
                return '-'
            }
        },
        mobileFilter(cellValue) {
        	if(cellValue){
		        return cellValue.replace(/(\d{3})\d{4}(\d{4})/, "$1****$2");
            }

        },
        PeriodFilters(cellValue){
	        return filterPeriod(cellValue)
        },
    },
    watch:{
	    Plis(val){
	    	console.log(val)
        }
    },
    computed:{
        ...mapGetters([
                'userIcon',
                'RoleGroup',
                'userId',
                'token',
	            'UserDic'
            ]),
    },
    async mounted(){
        let that= this
        let now = new Date();
        let nowTime = now.getTime() ;
        let day = now.getDay();
        let oneDayLong = 24*60*60*1000 ;
        if(day==0){     //西方从周日算为第一天    2018/10/28
            day=7
        }
        let MondayTime = nowTime - (day-1)*oneDayLong  ;
        let SundayTime =  nowTime + (7-day)*oneDayLong ;
        let monday = dateForm(new Date(MondayTime));
        let sunday = dateForm(new Date(SundayTime));
        that.timeDate= [
            monday,
            sunday
        ];   //初始化时间范围
        JSON.parse(localStorage.getItem('obesityManage'))?that.searchData=JSON.parse(localStorage.getItem('obesityManage')):''
        that.getNurse()// 获取营养师
	    await that.GetCommunityDistrict()
	    that.searchData.districtNo=JSON.parse(that.UserDic).DistrictNo||that.searchData.districtNo||''
        that.getList()

    },
    beforeMount:function() {
        let that=this;
        let appHeight=$(window).height();
        let autoheight=(appHeight-288)+'px'
        that.maxHeight=autoheight
    },
    methods: {
	    changeOther(data,type1,type2,index){  //清空选项
            this[data][type1] != index ? this[data][type2] = '' : null
        },
	    getBub(e,index){   //表格点击事件
            let slibling = e.target.parentNode.childNodes
            for(let i = 0; i<slibling.length;i++){
	            slibling[i].classList.remove('active')
            }
		    e.target.classList.add('active')
        },
        async GetCommunityDistrict(){    //获取社区行政区
            let that = this;
            await that.service({
                url: "/Dic/GetCommunityDistrict",
                method: "get",
                params: {
                }
            }).then(response => {
                that.optionDiq=response.dtData;
            })
            .catch(data => {

            });
        },
	    deleteChildTR(){  //删除儿科医生咨询表
		    let that=this;
		    that.$confirm('确认要删除本条信息吗？', '提示', {
			    confirmButtonText: '确定',
			    cancelButtonText: '取消',
			    type: 'warning'
		    }).then(() => {
			    that.service({
				    url:'/FatOutpatient/DeleteFatOutpatientPediatrician',
				    method:'post',
				    data:{
					    ...that.formx,
				    }
			    }).then(response=>{
				    that.dialogForm1=false
				    that.getList()
			    }).catch(data=>{
				    that.loadingQ=false
			    })
		    }).catch(() => {
			    that.dialogForm1=false
			    that.$message({
				    type: 'info',
				    message: '已取消'
			    });
		    });
        },
        deleteCrf(){         //删除营养师咨询表
            let that=this;
            that.$confirm('确认要删除本条信息吗？', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
            }).then(() => {
                that.service({
                    url:'/FatOutpatient/DeleteFatOutpatientDietitian',
                    method:'post',
                    data:{
                        ...that.FormAnli,
                    }
                }).then(response=>{
                    that.dialogFormAnli=false
                    that.getList()
                }).catch(data=>{
                    that.loadingQ=false
                })
            }).catch(() => {
                that.dialogFormAnli=false
                that.$message({
                    type: 'info',
                    message: '已取消'
                });
            });
        },
        changeFollowUpDate(row,val){
            this.setList(row)
        },
        ajaxFormx(){
	        this.service({
		        url:'/FatOutpatient/SaveFatOutpatientPediatrician',
		        method:'post',
		        data:{
			        ...this.formx,
		        }}).then(response=>{
		        this.dialogForm1=false
		        this.getList()
	        }).catch(data=>{
		        this.onOFFsub=false;
		        this.subDisabled=false
	        })
        },
        submitForm:function(type){   //提交
            let that=this;
            if(that.onOFFsub){
                that.subDisabled=true
                return false;
            }
            that.onOFFsub=true
            this.formx.ChildLikeFoods = this.ChildLikeFoods.join(',')
            this.formx.DietHabit = this.DietHabit.join(',')
            this.formx.LikeFoodType = this.LikeFoodType.join(',')
            this.formx.FollowUp = this.FollowUp.join(',')
	        let domTable = this.$refs.tableDom.querySelectorAll('tr');
            this.formx.ParentQuestion = ['','','','','','','']
            for(let i = 0 ;i<domTable.length;i++){
            	for(let j of domTable[i].querySelectorAll('td')){
                    if(j.className == 'active'){
	                    this.formx.ParentQuestion[i-1] = j.innerText
                    }
                }
            }
	        this.formx.ParentQuestion = this.formx.ParentQuestion.join(',')
            console.log(that.formPoint.CompleteState)
            if(that.formPoint.CompleteState !='1'){
                that.$confirm('自动将事项状态改为“已完成”，确定吗？', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
                }).then( async () => {
                    that.formx.IsComplete='1';
                    this.ajaxFormx()
                }).catch(e =>{
                    delete  that.formx.IsComplete
                    this.ajaxFormx()
                })
            }
            else{
                this.ajaxFormx()
            }

        },
        changeCops:function(val){
            this.FormAnli.Companions=val.join(',')
        },
        ajaxForm(){
	        this.service({
		        url: "/FatOutpatient/SaveFatOutpatientDietitiann",
		        method: "post",
		        data: {
			        ...this.FormAnli,
		        }
	        }).then(response => {
		        this.dialogFormAnli = false
		        this.rowOff=false
		        this.getList()
		        this.$message({
			        message:'保存成功',
			        type:'success'
		        })
	        }).catch(data => {
		        this.rowOff=false
		        console.log(data)
	        });
        },
        reportSure:function(formName){    //确认
            let that=this;
            if(that.rowOff){
                return false
            }
	        that.rowOff=true
            console.log(that.FormAnli.CompleteState)
            setTimeout( () =>{
            	if(that.formPoint.CompleteState !='1'){
		            that.$confirm('自动将事项状态改为“已完成”，确定吗？', '提示', {
			            confirmButtonText: '确定',
			            cancelButtonText: '取消',
			            type: 'warning'
		            }).then( async () => {
			            that.FormAnli.IsComplete='1';
			            that.ajaxForm()
		            }).catch(() => {
		            	delete that.FormAnli.IsComplete
			            that.ajaxForm()
		            });
                }
                else{
		            that.ajaxForm()
                }

            },200)
        },
        handleReport:function(row){    //营养师咨询表
            let that=this;
	        row.FatOutpatientDietitianId!==''?that.hasCount=true:that.hasCount=false
            that.dialogFormAnli=true;
            that.Companions=[]
            that.rowOff=false
            console.log(row)
            that.dataRow=''
            that.formPoint={};
            that.FormAnli={}
            that.formPoint=row
            that.dataRow=row;
            that.$nextTick( async () =>{
            	if(row.FatOutpatientDietitianId){
		            that.service({
			            url: "/FatOutpatient/GetFatOutpatientDietitian",
			            method: "get",
			            params: {
				            sysId:row.FatOutpatientDietitianId
			            }
		            }).then(response => {
			            if(response.dtData.length>0){
				            that.FormAnli=response.dtData[0]
				            that.Companions=(response.dtData[0].Companions||'').split(',')
			            }
		            }).catch(data => {

		            });
                }
	            that.FormAnli.ResearchObjectId=row.ResearchObjectId
	            that.FormAnli.FatOutpatientId=row.SYS_ID
                that.FormAnli.CompleteState = row.CompleteState
            })
        },
        handleTable(row){  //儿科医生咨询表
	        this.dialogForm1=true;
	        this.onOFFsub=false;
	        row.FatOutpatientPediatricianId!==''?this.hasCount=true:this.hasCount=false
	        this.formPoint={}
	        this.dataRow=''
	        this.tablerow=row
	        this.labelList=[]
	        this.formPoint=row
	        this.dataRow=row
            this.formx = {}
            this.$nextTick( async () =>{
	            let domTable = this.$refs.tableDom.querySelectorAll('tr');
	            if(row.FatOutpatientPediatricianId){
		            let response = await this.service({
			            url:'/FatOutpatient/GetFatOutpatientPediatrician',
			            method:'get',
			            params:{
				            sysId:row.FatOutpatientPediatricianId
			            }
		            })
		            this.formx = Object.assign(response.dtData[0])
		            this.formx.ChildLikeFoods?
                        this.ChildLikeFoods = this.formx.ChildLikeFoods.split(',')
                        :this.ChildLikeFoods = []
		            this.formx.DietHabit?
			            this.DietHabit = this.formx.DietHabit.split(',')
			            :this.DietHabit = []
		            this.formx.LikeFoodType?
			            this.LikeFoodType = this.formx.LikeFoodType.split(',')
			            :this.LikeFoodType = []
		            this.formx.FollowUp?
			            this.FollowUp = this.formx.FollowUp.split(',')
			            :this.FollowUp = []
                    if(this.formx.ParentQuestion){
	                    let arrData = this.formx.ParentQuestion.split(',')
	                    arrData.map((item,index) =>{
		                    if(item){
			                    domTable[index+1].querySelectorAll('td')[parseInt(item)].classList.add('active')
		                    }
	                    })
                    }
	            }
	            this.formx.ResearchObjectId=row.ResearchObjectId
	            this.formx.FatOutpatientId=row.SYS_ID
            })

        },
        tableSure:function(){    //确认
            let that=this;
            that.setList(that.addForm1)
            that.dialogVisible=false
        },
        checkList:function(){   //查询
            this.pageId=1;
            this.pageSize=10;
            this.total=null;
            this.getList()
            let storageObj=this.searchData
            localStorage.setItem('obesityManage',JSON.stringify(storageObj))
        },
        changeFollowUpDateOne:function(row,val){
            let that=this;
            if(row.AppointState==0){
                this.$confirm('是否将预约状态改为已确认 , 是否继续?', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
                }).then(() => {
                   row.AppointState='1';
                   that.setList(row)
                }).catch(() => {
                    that.setList(row)
                });
            }
            else{
                 that.setList(row)
            }
        },
        JumpUserinfo:function(row){   //跳转用户基本信息
            let that=this;
            that.$router.push({
                path:'/participant/editor',
                query:{
                    id:row.ResearchObjectId,
                    mobile:row.Mobile,
                    researchNo:row.ResearchNo,
                }
            })
        },
        handleSizeChange(val) {       //条数改变
            this.pageSize=val;
            this.getList()
        },
        handleCurrentChange(val) {    //页数改变
            this.pageId = val
            this.getList()
        },
        async setList(row,type){  //修改
            let that=this;
            row.CancleReason = row.CompleteState != 2 ? '' : row.CancleReason
            try {
	            let response = await that.service({
		            url: '/FatOutpatient/SaveFatOutpatient',
		            method: 'post',
		            data: {
			            ...row
		            }
	            })
	            that.$message({
		            message: '修改成功',
		            type: 'success'
	            });
	            type != 'N' ? that.getList() : null
            }catch(e) {
                console.log(e)
            }
        },
        getList:function(){           //获取一级信息列表
            let that=this
            that.loading=true
            that.service({
                url:'/FatOutpatient/GetFatOutpatient',
                method:'get',
                params:{
                    pageCount:(that.pageId-1),
                    pageSize:that.pageSize,
                        ...that.searchData,
                    startDate:that.timeDate?that.timeDate[0]:'',
                    endDate:that.timeDate?that.timeDate[1]:'',
                }
                }).then(response=>{
                    that.tableData=response.dtData;
                    that.total =parseInt(response.dtData[0].TotalCount);
                    console.log(response)
                    that.loading=false
                }).catch(data=>{
                that.loading=false
            })
        },
        getNurse:function(){
            let that=this;
            that.service({
                url:'/Sys/GetNurse',
                method:'get',
                params:{
                    roleGroup:'11'
                }
            }).then(response=>{
                let options=response.dtData
                for(let i of options){    //处理姓名账号不一致，Nan
                    i.Name=i.Name || ''
                    let username=i.Surname+i.Name
                    username=='undefined'?username=i.UserCode:username=username
                    i.icons=username
                }
                that.optionsNurse=options;
                console.log(that.optionsNurse)
            }).catch(data=>{

            })
	        that.service({
		        url:'/Sys/GetNurse',
		        method:'get',
		        params:{
			        roleGroup:'5'
		        }
	        }).then(response=>{
		        let options=response.dtData
		        for(let i of options){    //处理姓名账号不一致，Nan
			        i.Name=i.Name || ''
			        let username=i.Surname+i.Name
			        username=='undefined'?username=i.UserCode:username=username
			        i.icons=username
		        }
		        that.optionsDoc=options;
	        }).catch(data=>{

	        })
        },
        changeNurse:function(row,val){
            let that=this;
            this.$confirm('更换营养师后，请重新填写就诊时间, 是否继续?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
            }).then(() => {
                that.optionsNurse.forEach(function (item) { //绑定ID
                    if(item.icons==val){
                        row.NurseId=item.SYS_ID
                    }
                })
                row.VisitTime=''
                this.setList(row)
            }).catch(() => {
                that.$message({
                    message:'已取消',
                    type:'info'
                })
                that.getList()
            });
        }
    }
  }
function addZero(s){
    return s < 10 ? '0' + s: s;
}
function dateForm(data){
    return   new Date(data).getFullYear()+'-'+addZero((new Date(data).getMonth()+1))+'-'+addZero(new Date(data).getDate())
}
</script>
<style scoped lang="scss">
    .formX{
    .top{
        text-align: center;
    }
    ul{
    li{
        padding:20px;
        border-bottom: 1px solid #DCDFE6;
        .check_1{
            display: block;
            .el-checkbox-group{
                label{
                    min-width: 150px;
                }

            }
        }

    h3 {
        color: #606266;
        font-size: 16px;
        font-weight: bolder;
	    margin:10px 0px;
    }
        h4{
            color: #606266;
            font-weight: normal;
            font-size: 14px;
            margin:5px 0 5px 15px;
            display: flex;
            line-height: 36px;
            span{
                flex: 5;
            }
            .el-radio-group{
                flex: 1;
            }
        }
        .check-1{
            .el-checkbox{
                min-width: 200px;
                margin-bottom: 0px;
            }
        }
	    .el-textarea{
		    margin: 10px 0px;
	    }
    h5{
        font-weight: normal;
        padding:0px 0 0px 50px;
        font-size: 14px;
	    line-height: 36px;

        p{
            font-size: 14px;
            color: #606266;
            margin:0px 0px 0px 20px;
        }
    }
    p{
        color: #999999;
        margin-bottom: 10px;
        margin:10px 0px;
    }
    }
    }
    }
    .click_line{cursor: pointer;color:#409EFF;}
    .fade-enter-active, .fade-leave-active {
        transition: opacity .4s;
    }
    .fade-enter, .fade-leave-to{
        opacity: 0;
    }
    .pagination-fixed{
     position: static;
    }
    .formPlebek{color:#0066FF }
    .conItem .el-form-item__content{height: auto}
    .parentDiv{
        border:1px solid #DCDFE6;
        padding:30px;
	    margin: 15px 0px;
	    margin-left: 80px;
        background: #FFFFCC;
        table{
            width: 100%;
            border-collapse: collapse;
            tr{
                td{
                    border:1px solid #DCDFE6;
                    box-sizing: border-box;
                    padding:8px 0px;
                    text-align: center;
                    background: #FFFFCC;
                    color: #606266;
                }
                .active{
                    background: #2DA3FB;
                    color: #fff;
                }
            }
        }
    }
	.forl-div{
		display: flex;
		line-height: 36px;
		span{
			flex: 5;
		}
		.el-radio-group{
			flex:3.5 !important;
		}
	}
	.pdl{
		text-align: left !important;padding:  5px !important;
	}
</style>
